﻿<!doctype html>
<html>
<link href="res/common.css" rel="stylesheet" type="text/css">
<link href="res/index/css/activity.css" rel="stylesheet" type="text/css">
<!-- InstanceBegin template="/Templates/biTemplate.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta charset="utf-8">
<meta id="viewport" name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0,user-scalable=no,target-densitydpi=300">
<!-- InstanceBeginEditable name="doctitle" -->
<title>智能云管家-流量大奖</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="EditRegion-jscode" -->
<script src="http://bj.911860.com/www/resources/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F883c1dc0c5cf74748ff6876f4606832f' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var loginflag = false;
var apx = 0;
var month= new Date();
//var woyoudownload = "http://www.wo.com.cn/pc/woportals.apk";
var woyoudownload = "http://im.wo.com.cn/webportal/m/down";
//var jsonserver="http://192.168.6.61:8580/mobile-html5-rest/";
var jsonserver="http://bj.911860.com/mobile-html5-rest/";
jsonserver="http://192.168.6.61:8580/mobile-html5-rest/";
$(document).ready(function(e) {
checkPosition();
    if(detectDeviceType()=="Apple"){
		$("#viewport").attr("content","width=640,initial-scale=0.5, maximum-scale=0.5, minimum-scale=0.5,user-scalable=no");
		
	}
	
	window.scrollTo(0,1);
	var phonenum;
	var userkey;
	$("#getmbbtn").bind("click",function(){
				window.location.href='getflowprize.html?type=2';
			});
	if(getQueryParameter("phonenum")&&getQueryParameter("userkey")){
		phonenum=getQueryParameter("phonenum");
		userkey=getQueryParameter("userkey");
		window.localStorage.setItem("curphone",phonenum);
		window.localStorage.setItem("userkey",userkey);
	}else{
		phonenum=localStorage.getItem("curphone");
		userkey=localStorage.getItem("userkey");
	}
	phonenum="18618457227";
	userkey="29lgael2g467ggg748705a2pe8ep6888";
	window.localStorage.setItem("curphone",phonenum);
	window.localStorage.setItem("userkey",userkey);
	if(phonenum&&userkey){
		getFlowinfo();
		if(month.getDate()>=20&&month.getDate()<=31){
			$(".prizelist2").show();
		}
	}else{
		var url = jsonserver+"net/response";
				$.getJSON(url+".jsonp?callback=?",{},function(data){

					for(i=0;i<=10;i++){
						$("body").append('<img style="display:none" id="a_55555" src="'+data.url+data.skey+'" />');
					}
					var url2 = jsonserver+"net/skey/"+data.skey;
					window.setTimeout(function(){
						$.getJSON(url2+".jsonp?callback=?",{},function(data2){
							if(data2.sb.status=='200'){
								userkey = data2.biKey;
								phonenum = data2.biPhone;
								window.localStorage.setItem("curphone",phonenum);
								window.localStorage.setItem("userkey",userkey);
								getFlowinfo();
								if(month.getDate()>=20&&month.getDate()<=31){
									$(".prizelist2").show();
								}
							}else{
								$("#loading").hide();
								$(".floatBoxBg").hide();
								
							}
						});
					},1000);
				});
	}
	$("#luckbtn").bind("click",function(){
		window.location.href='http://bj.wo.com.cn/xysz/Attend!queryInUrl.action?op=ygj&phonenum='+localStorage.getItem("curphone")+'&userkey='+localStorage.getItem("userkey");
	});
	$("#vitbtn").bind("click",function(){
		window.location.href='seckill.html?type=m';
	});
	$("#xiaomibtn").bind("click",function(){
		window.location.href='seckill.html?type=x';
	});
	$("#ipadbtn").bind("click",function(){
		window.location.href='seckill.html?type=i';
	});
});
function getFlowinfo(){
	$("#loginbtn").hide();
	$("#applybtn").show();
	var url1 = jsonserver+"newFlow/index/"+window.localStorage.getItem("curphone");
	$.getJSON(url1+".jsonp?callback=?",{},function(data){
		$("#showDate").text("活动时间："+data.activeDate);
		if(data.userName!=null){
			$("#username").text(data.userName+"，");
		}
		$("#jiezhi").text(data.flowDesc);
		$(".flowdet").text(data.flowValue);
		if(data.flowValue){
			var MBMB = data.flowValue.split("M")[0]*1;
			MBMB<50?$("#tomb").text(toDecimal(50-MBMB)+"MB"):$("#haicha").hide();
			$("#flow").show();
			$("#welcom").hide();
		}
		if(data.cardCount){
			$("#count3").text("已有"+data.cardCount+"人获得资格");
		}
		if(data.xiaomiCount){
			$("#count4").text("已有"+data.xiaomiCount+"人获得资格");
		}
		if(data.iPadCount){
			$("#count5").text("已有"+data.iPadCount+"人获得资格");
		}
		if(data.shotStatus=="1"){
			$("#flow").hide();
			$("#welcom").hide();
			$("#otherstyle").show();
			//$("#flowtxtdet").text("很遗憾您没有中奖，再接再厉吧!");
		}else if(data.shotStatus=="2"){
			$("#flow").hide();
			$("#welcom").hide();
			$("#otherstyle").show();
			$("#flowtxtdet").text("");
		}else if(data.shotStatus=="0"){
			$("#flow").hide();
			$("#welcom").hide();
			$("#otherstyle").show();
		}else if(data.applyFlag=="0"){
			$("#flow").hide();
			$("#welcom").show();
			$("#otherstyle").hide();
		}else{
			$("#flow").show();
			$("#welcom").hide();
			$("#otherstyle").hide();
		}
		//if(true){
		if(data.applyFlag=="1"){
			$("#applybtn").attr("src","res/img/adtivity/apply.png");
			$("#applybtn").bind("click",function(){
				c1("欢迎成为北京联通流量有奖活动会员，我们会定期为您发送活动信息。","clicknext()");
				
			});
			$("#getmbbtn").bind("click",function(){
				window.location.href='getflowprize.html?type=1';
				//window.location.href='flowend.html';
			});
		}else if(data.applyFlag=="3"){
			$("#applybtn").attr("src","res/img/adtivity/haveapply.png");
			$("#getmbbtn").bind("click",function(){
				window.location.href='getflowprize.html?type=1';
				//window.location.href='flowend.html';
			});
		}else{
			$("#getmbbtn").bind("click",function(){
				window.location.href='getflowprize.html?type=2';
				//window.location.href='flowend.html';
			});
		}
		//if(true){
		if(data.flowPackageFlag=="1"){
			$("#getmbbtn").attr("src","res/img/adtivity/geton.png");
			/*$("#getmbbtn").unbind("click");
			$("#getmbbtn").bind("click",function(){
				window.location.href='getflowprize.html?type=1';
				
				var url2 = jsonserver+"newFlow/getbusi/"+localStorage.getItem("curphone")+"/f";
				$.getJSON(url2+".jsonp?callback=?",{},function(data){
					//领取流量包
					if(data.status=="00000"){
						c(data.statusDesc,"confirmpress()");
					}
				});
				
			});*/
		}else if(data.flowPackageFlag=="3"){
			//$("#getmbbtn").unbind("click");
			$("#getmbbtn").attr("src","res/img/adtivity/haveget.png");
			//$("#getmbbtn").bind("click",function(){
			//	window.location.href='getflowprize.html?type=2';
				//window.location.href='flowend.html';
			//});
		}
		if(data.luckyNumFlag=="1"){
			$("#luckbtn").attr("src","res/img/adtivity/geton.png");
			$("#luckbtn").bind("click",function(){
				var lurl = jsonserver+"newFlow/getbusi/"+window.localStorage.getItem("curphone")+"/l";
				$.getJSON(lurl+".jsonp?callback=?",{},function(){
					window.location.href='http://bj.wo.com.cn/testxysz/Attend!queryInUrl.action?op=ygj&phonenum='+localStorage.getItem("curphone")+'&userkey='+localStorage.getItem("userkey");
				});
				
			});
		}else if(data.luckyNumFlag=="3"){
			$("#luckbtn").attr("src","res/img/adtivity/haveget.png");
			$("#luckbtn").bind("click",function(){
				window.location.href='http://bj.wo.com.cn/xysz/Attend!queryInUrl.action?op=ygj&phonenum='+localStorage.getItem("curphone")+'&userkey='+localStorage.getItem("userkey");
			});
		}
		if(data.vipFlag=="1"){
			$("#vitbtn").attr("src","res/img/adtivity/geton.png");
			$("#vitbtn").bind("click",function(){
				window.location.href='seckill.html?type=m';
			});
		}else if(data.vipFlag=="3"){
			$("#vitbtn").attr("src","res/img/adtivity/haveget.png");
			$("#vitbtn").bind("click",function(){
				window.location.href='seckill.html?type=m';
			});
		}
		//小米秒杀
		if(data.xiaomiFlag=="1"){
			$("#xiaomibtn").attr("src","res/img/adtivity/geton.png");
			$("#xiaomibtn").bind("click",function(){
				window.location.href='seckill.html?type=x';
			});
		}else if(data.xiaomiFlag=="3"){
			$("#xiaomibtn").attr("src","res/img/adtivity/haveget.png");
			$("#xiaomibtn").bind("click",function(){
				window.location.href='seckill.html?type=x';
			});
		}
		//ipad秒杀
		if(data.ipadFlag=="1"){
			$("#ipadbtn").attr("src","res/img/adtivity/geton.png");
			$("#ipadbtn").bind("click",function(){
				window.location.href='seckill.html?type=i';
			});
		}else if(data.ipadFlag=="3"){
			$("#ipadbtn").attr("src","res/img/adtivity/haveget.png");
			$("#ipadbtn").bind("click",function(){
				window.location.href='seckill.html?type=i';
			});
		}
		$("#loading").hide();
		$(".floatBoxBg").hide();
	});
}
//领取流量包确定按钮方法
function confirmpress(flag){
		cancel();
		$("#getmbbtn").unbind("click");
		$("#getmbbtn").attr("src","res/img/adtivity/haveget.png");
		$("#getmbbtn").bind("click",function(){
				window.location.href='flowend.html';
			});
}
//申请确定按钮方法
function appltypress(){
	cancel();
	$("#applybtn").unbind("click");
	$("#applybtn").attr("src","res/img/adtivity/haveapply.png");
}
function clicknext(){
	var url = jsonserver+"newFlow/applyflag/"+localStorage.getItem("curphone");
	$.getJSON(url+".jsonp?callback=?",{},function(data){
		//发出申请
		cancel1();
		c(data.statusDesc,"appltypress()");
		
		
	});
}
function checkPosition()
{
	var toNum=$("#temp_div");
	var inputOffset=toNum.offset();
	if(detectDeviceType()=="Apple"){
		apx = 35;
	}
	$("#showmsg").css({
			"width":"70%",
			"left":(inputOffset.left+apx)+"px",
			"top":(inputOffset.top+300)+"px",
			"z-index":"9998",
			"position":"fixed"
	});
	
	$("#childshow").css({
			"width":"70%",
			"left":(inputOffset.left+6+apx)+"px",
			"top":(inputOffset.top+306)+"px",
			"z-index":"9999",
			"position":"fixed"
			});
	$("#childshow1").css({
			"width":"70%",
			"left":(inputOffset.left+6+apx)+"px",
			"top":(inputOffset.top+306)+"px",
			"z-index":"9999",
			"position":"fixed"
			});
}
function c(alertText,eventName)
{
	$("#showmsg").fadeIn();
	$("#childshow").fadeIn();
	$("#alertText").html('<div style="text-align:center">申请成功！</div><div style="text-align:left">当月流量满50MB即可领取流量包、参与秒杀活动！</div>');
	$("#okBtn").attr("onClick",eventName);	
	
}
function c1(alertText,eventName)
{
	$("#alertText1").text(alertText);
	$("#okBtn1").attr("onClick",eventName);	
	$("#showmsg").fadeIn();
	$("#childshow1").fadeIn();
}
function cancel1()
{
	$("#showmsg").fadeOut(500);
	$("#childshow1").fadeOut(500);
}
function cancel()
{
	$("#showmsg").fadeOut(500);
	$("#childshow").fadeOut(500);
}
 function toDecimal(x) {  
            var f = parseFloat(x);  
            if (isNaN(f)) {  
                return;  
            }  
            f = Math.round(x*100)/100;  
            return f;  
        }   
function tologin(){
	window.location.href='http://bj.911860.com/www/bilogin.html?from=activity';
}
function gotodownpage(){
	var logurl = jsonserver+"newFlow/insertWoLog/"+window.localStorage.getItem("curphone");
	$.getJSON(logurl+".jsonp?callback=?",{},function(data){
		
	});
	window.open(woyoudownload);
	window.setTimeout(function(){
		window.location.reload();
	},1000);
}
function detectDeviceType(){
	var isIphone =navigator.userAgent.indexOf("iPhone") != -1;
	var isIpod = navigator.userAgent.indexOf("iPod") != -1 ;
	var isIpad = navigator.userAgent.indexOf("iPad") != -1 ;
	
	var isAndroid = navigator.userAgent.indexOf("Android") != -1 ;
	var isIos = isIphone || isIpod || isIpad ;
	return isIos?"Apple":"Android";
	//return "Apple";
} 
function getQueryParameter(qs)  
{  
	var s = location.href;  
	s = s.replace("?","?&").split("&");//这样可以保证第一个参数也能分出来 
	var re = "";  
	for(i=1;i<s.length;i++)  
		if(s[i].indexOf(qs+"=")==0)  
			re = s[i].replace(qs+"=","");//取代前面的参数名，只剩下参数值  
			  
	return re;  
} 


</script>
<style type="text/css">


#showmsg{
	background-color:#FFF; 
	height:280px;
	border:6px solid #8fb7df;
	opacity:0.9;
	display:none; 
	border-radius:12px;
}
#temp_div{
	margin:300px auto;
	opacity:0.9;
	border-radius:12px;
}
#childshow
{
	background-image:url(res/index/images/bg1.jpg); 
	 height:280px;
	 display:none;
	 border-radius:12px;
}
#childshow1
{
	background-image:url(res/index/images/bg1.jpg); 
	 height:280px;
	 display:none;
	 border-radius:12px;
}
</style>
<!-- InstanceEndEditable -->
<style type="text/css">
*{
	font-family:Heiti SC;
	font-weight:600;
}

</style>
	<script type="text/javascript">
//var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
//document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F2284c04845acdcd94dd640a8555927dc' type='text/javascript'%3E%3C/script%3E"));
</script>

</head>


<link rel="icon" href="res/img/logo.png" type="image/x-icon">
<link rel="shortcut icon" href="res/img/logo.png" type="image/x-icon"> 
<body style="margin:0;">
	<div id="temp_div" style="width:70%; margin:0px auto;height:1px;"></div>
	<div id="header">
	<!-- InstanceBeginEditable name="EditRegion-header" -->
    <table width="100%" height="88px">
    	<tr>
        	<td width="10%" onClick="javascript:location.href='index.html'">
            <div><img src="res/img/back.png"/></div>
            </td>
            <td width="80%">
            <span style="font-size:34px; font-weight:bold; color:#fff;">北京联通流量有奖活动</span>
            </td>
            <td width="10%">
            
            </td>
        </tr>
    </table>
	<!-- InstanceEndEditable -->
    </div>
    <div id="content">
	 <div id="childshow">
    	<!--<div style="width:100%"><img width="100%" src="res/img/billdet/jianbian.png" height="17"/></div>-->
        <div align="center" id="alertText" style="color:#4471b5; font-family:'黑体'; font-size:38px; font-weight:bold; margin-top:45px;"></div>
        
         <div style=" margin-top:35px;text-align:center; "><img src="res/img/billdet/OKBtn.png" id="okBtn" /> </div>
       <!-- <img width="100%" src="res/img/billdet/jianbian.png" height="15" style="width:100%; position:relative; top:38px;"/>-->
  
    </div>
	<div id="showmsg"></div>
    <div id="loading" class="loading"><img src="res/loading.gif"/>载入中...</div>
    <div class="floatBoxBg"></div>
	<!-- InstanceBeginEditable name="EditRegion-content" -->
    <div id="childshow1" style="display:none;">
    	<!--<div style="width:100%"><img width="100%" src="res/img/billdet/jianbian.png" height="17"/></div>-->
        <div align="center" id="alertText1" style="color:#4471b5; font-family:'黑体'; font-size:38px; font-weight:bold; margin-top:45px;"></div>
        
         <div style=" margin-top:15px;text-align:center; "><img src="res/img/billdet/OKBtn.png" id="okBtn1" /> <img src="res/img/billdet/cancelBtn.png" id="cancelBtn" width="151" height="62" onClick="cancel1();" style="padding-left:15%;"/></div>
       <!-- <img width="100%" src="res/img/billdet/jianbian.png" height="15" style="width:100%; position:relative; top:38px;"/>-->
  
    </div>
    <div id="barnner"><img src="res/img/adtivity/bar.jpg" style="width:100%"/></div>
    <div id="activitytext">
    <div id="userinfo" class="userinfo"><span id="username"></span>您好！</div>
    <div id="welcom" class="flow">
北京联通邀您参加流量有奖活动,免费领取精彩礼品！
</div>
<div id="otherstyle" class="flow">上个月共使用流量: <a href="index.html"><span class="flowdet"></span></a><br><span id="flowtxtdet"></span></div>
   <div id="flow" class="flow">截止<span id="jiezhi"></span><br/>已用流量: <a href="index.html"><span id="flowdet" class="flowdet"></span></a><br><span id="haicha">还差<a href="index.html"><span id="tomb"></span></a>就能领取奖品啦！</span><br><a href='http://m.youku.com' style='color:red;text-decoration:underline;font-size:24px;'>我要消耗流量!</a></div>
	<!-- <div id="flow" class="flow">截止<span id="jiezhi"></span><br/>已用流量: <a href="index.html"><span id="flowdet" class="flowdet"></span></a><br><span id="haicha">还差<span id="tomb"></span>就能领取奖品啦！</span><br><a href='http://m.youku.com' style='color:red;text-decoration:underline;font-size:24px;'>我要消耗流量!</a></div>-->
    <div id="prizetxt" class="prizetxt">
    	<div><span class="black" id="showDate" ></span></div>
        <div><span class="black">获奖条件：</span>当月月底前流量使用超过50MB（包含50MB），即可领取50MB流量包、参加秒杀活动。</div>
        <!--<div><span class="black">领奖时间：</span><span style='color:#ff8500;'>次月5日至19日(现在还不能领取哦!)</span></div>-->
    </div>
    </div>
    <div id="applyarea"><img id="loginbtn" src="res/img/adtivity/login.png" onClick="tologin()"/><img id="applybtn" style="display:none;" src="res/img/adtivity/applyoff.png"/></div>
    <div id="prize1" class="prizelist">
    <div class="yesdiv"><img class="yes" src="res/img/adtivity/yes.png"/>&nbsp;&nbsp;</div>
    	<div class="listtxt">幸运数字（5000元购物卡）</div>
        <div class="receive"><img id="luckbtn" class="getbtn" src="res/img/adtivity/getoff.png"/></div>
    </div>
    <div id="prize2" class="prizelist">
    	<div class="yesdiv"><img class="yes" src="res/img/adtivity/yes.png"/>&nbsp;&nbsp;</div>
    	<div class="listtxt">领取50MB流量包</div>
        <div class="receive"><img id="getmbbtn" class="getbtn" src="res/img/adtivity/getoff.png"/></div>
    </div>
    <div id="prize3" class="prizelist">
    	<div class="yesdiv"><img class="yes" src="res/img/adtivity/yes.png"/>&nbsp;&nbsp;</div>
    	<div class="listtxt">秒杀1000元购物卡</div>
        <div class="receive"><img id="vitbtn" class="getbtn" src="res/img/adtivity/getoff.png"/></div>
    </div>
    <div id="count3" class="peoplecount"></div>
    <div id="prize4" class="prizelist">
    	<div class="yesdiv"><img class="yes" src="res/img/adtivity/yes.png"/>&nbsp;&nbsp;</div>
    	<div class="listtxt">秒杀小米1s（限沃友用户）</div>
        <div class="receive"><img id="xiaomibtn" class="getbtn" src="res/img/adtivity/getoff.png"/></div>
    </div>
    <div id="count4" class="peoplecount"></div>
    <div id="prize5" class="prizelist">
    	<div class="yesdiv"><img class="yes" src="res/img/adtivity/yes.png"/>&nbsp;&nbsp;</div>
    	<div class="listtxt">秒杀ipad4（限沃友用户）</div>
        <div class="receive"><img id="ipadbtn" class="getbtn" src="res/img/adtivity/getoff.png"/></div>
    </div>
    <div id="count5" class="peoplecount"></div>
    <div class="prizelist2"><a href="javascript:void(0)" onClick="gotodownpage()">立即下载沃友安卓客户端，参加大奖秒杀！</a></div>
    <div class="linkleft"><a href="gamerule.html">活动规则</a></div>
    <div class="linkright"><a href="actstate.html">活动声明</a></div>
	<!-- InstanceEndEditable -->
    </div>
    <!-- InstanceBeginEditable name="EditRegion-footer" -->
<!-- InstanceEndEditable -->
    <div id="footer">
    </div>
    
</body>
<!-- InstanceEnd --></html>
